

(function( $ ){
    $(function() {
        var locat = (window.location+'').split('/'); 
    	if('pictures'== locat[3]){locat =  locat[0]+'//'+locat[2];}else{locat =  locat[0]+'//'+locat[2]+'/'+locat[3];};
    	alert(1);
    	$(".filePicker").each(function(i){
    		var target = $(this).attr("id");
	        uploader = WebUploader.create({
	            pick: {
	                id: '#'+target,
	                label: '点击选择图片'
	            },
	            formData: {uid: 123},
	            auto: true,
	            swf: './Uploader.swf',
	            chunked: false,
	            chunkSize: 512 * 1024,
	            server: locat+'/pictures/save.do',
	            accept: {
	                 title: 'Images',
	                 extensions: 'gif,jpg,jpeg,bmp,png',
	                 mimeTypes: 'image/*'
	             },
	            disableGlobalDnd: true,
	            fileNumLimit: 1,
	            fileSizeLimit: 200 * 1024 * 1024,    // 200 M
	            fileSingleSizeLimit: 50 * 1024 * 1024    // 50 M
	        });
	        uploader.on( 'uploadAccept', function( object ,ret  ) {
	        	if(ret){
	        		alert(ret.name);
	        	}
	        });
    	});
    });
})( jQuery );